﻿<controls:ChildWindow x:Class="MVVMBasic.View.CustomerDetailsView"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
                      xmlns:vm="clr-namespace:MVVMBasic.ViewModel"
                      Width="320"
                      Height="216"
                      Title="Customer Details"
                      HasCloseButton="False">

    <controls:ChildWindow.DataContext>
        <vm:CustomerDetailsViewViewModel />
    </controls:ChildWindow.DataContext>

    <Grid x:Name="LayoutRoot"
          Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"
                           MinHeight="28" />
            <RowDefinition Height="Auto"
                           MinHeight="24" />
            <RowDefinition Height="Auto"
                           MinHeight="32" />
            <RowDefinition Height="Auto"
                           MinHeight="32" />
            <RowDefinition Height="Auto"
                           MinHeight="2.875" />
            <RowDefinition Height="Auto"
                           MinHeight="38.125" />
        </Grid.RowDefinitions>



        <StackPanel Orientation="Horizontal">
            <TextBlock Text="ID:"
                       Margin="5"
                       Width="75" />
            <TextBox Width="50"
                     Margin="5"
                     Text="{Binding WorkingItem.Id, FallbackValue=0, Mode=TwoWay}" />
        </StackPanel>
        <StackPanel Orientation="Horizontal"
                    Grid.Row="1">
            <TextBlock Text="First Name:"
                       Margin="5"
                       Width="75" />
            <TextBox Margin="5"
                     Width="203"
                     Text="{Binding WorkingItem.FirstName, Mode=TwoWay}" />
        </StackPanel>
        <StackPanel Orientation="Horizontal"
                    Grid.Row="2">
            <TextBlock Text="Last Name:"
                       Margin="5"
                       Width="75" />
            <TextBox Width="203"
                     Margin="5"
                     Text="{Binding WorkingItem.LastName, Mode=TwoWay}" />
        </StackPanel>
        <StackPanel Orientation="Horizontal"
                    Grid.Row="3">
            <TextBlock Text="Birth Date:"
                       Margin="5"
                       Width="75" />
            <controls:DatePicker Width="131"
                                 Margin="5"
                                 SelectedDate="{Binding WorkingItem.BirthDate, Mode=TwoWay}" DisplayDateStart="01/01/1910" DisplayDate="01/01/1910"/>
            <TextBox Margin="10,5,0,5"
                     TextWrapping="Wrap"
                     HorizontalAlignment="Right"
                     Text="{Binding WorkingItem.Age, Mode=TwoWay}"
                     Width="57" />
        </StackPanel>
        <StackPanel Grid.Row="5"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right">
            <Button x:Name="SaveButton"
                    Content="Save"
                    Width="75"
                    Height="23"
                    HorizontalAlignment="Right"
                    Margin="5"
                    VerticalAlignment="Top"
                    Command="{Binding SaveCommand, Mode=OneWay}" />
            <Button x:Name="CancelButton"
                    Content="Cancel"
                    Width="75"
                    Height="23"
                    HorizontalAlignment="Right"
                    Margin="5"
                    VerticalAlignment="Top"
                    Command="{Binding CancelCommand, Mode=OneWay}" />
        </StackPanel>
    </Grid>
</controls:ChildWindow>